﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Coolite.Ext.Web;

namespace GUESTSMANAGEMENT
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.GMUser.Visible = false;
            //this.GMGuests.Visible = false;
            this.GMEvent.Visible = false;
            this.GMListGuest.Visible = false;
            this.Report.Visible = false;
            this.DetailReport.Visible = false;
            
            if ((Session["userCd"] != null) && (Session["userId"] != null) && (Session["userName"] != null) && (Session["userPassword"] != null) && (Session["userEnabled"] != null) && (Session["userType"] != null))
            {
                this.LoadMenu((int)Session["userType"]);
            }
            else
            {
                Session.Abandon();
                Response.Redirect("Login.aspx");
            }
        }


        public void LoadMenu(int type)
        {

            string userType = type.ToString();

            if (userType == "1")
            {
                this.GMUser.Visible = true;
                //this.GMGuests.Visible = true;
                this.GMEvent.Visible = true;
                this.GMListGuest.Visible = true;
                this.Report.Visible = true;
                this.DetailReport.Visible = true;
                this.ReportAna.Visible = true;
            }

            if (userType == "2")
            {
                this.GMUser.Visible = true;
                //this.GMGuests.Visible = true;
                this.GMEvent.Visible = true;
                this.GMListGuest.Visible = true;
                this.Report.Visible = true;
                this.DetailReport.Visible = true;
                this.ReportAna.Visible = true;
            }

            if (userType == "3")
            {
                this.GMUser.Visible = false;
                //this.GMGuests.Visible = true;
                this.GMEvent.Visible = false;
                this.GMListGuest.Visible = true;
                this.Report.Visible = false;
                this.DetailReport.Visible = false;
                this.ReportAna.Visible = false;
            }
        }

        public void Logout(object sender, AjaxEventArgs e)
        {
            Response.Redirect("Logout.aspx");
        }
    }
}
